

import { request } from '@inbiz/utils';
/**
 * 根据值查询数据详情(接口工厂)
 * @param appId appId
 * @param id 搜索id,多个用','隔开
 * @param key 查询器id,多个用','隔开
 */
export async function getTableInfoApi(param: { appId: string; id: string; key: string }) {
  return request(
    `/inbiz/api/services/front/modelengine/v${InbizConfig.API_VERSION}/businessData/dataInterface`,
    {
      method: 'POST',
      data: param,
    },
  );
}

/**
 * 根据值查询模型
 * @param appId appId
 */
export async function getModelList(appId: string) {
  return request(
    `/inbiz/api/services/modelengine/v${InbizConfig.API_VERSION}/model/publishs/${appId}?pageIndex=1&pageSize=100`,
  );
}

/**
 * 根据值查询模型详情
 * @param appId appId
 * @param modelKeys model key
 */
export async function getModelInfo(appId: string, modelKeys: string[]) {
  return request(`/inbiz/api/services/modelengine/v${InbizConfig.API_VERSION}/model/manyFields`, {
    method: 'post',
    data: {
      appId,
      modelKeys: modelKeys,
      includeSystem: true,
    },
  });
}